<?php
global $_GPC, $_W;
// $action = 'ad';
// $title = $this->actions_titles[$action];
$GLOBALS['frames'] = $this->getMainMenu();
$item=pdo_get('zh_gjhdbm_qiniu',array('uniacid'=>$_W['uniacid']));
    if(checksubmit('submit')){
            $data['accesskey']=trim($_GPC['accesskey']);
            $data['secretkey']=trim($_GPC['secretkey']);
            $data['bucket']=trim($_GPC['bucket']);
            $data['url']=trim($_GPC['url']);
            $data['is_open']=$_GPC['is_open']; 
            if($_GPC['accesskey']==''){
                message('accesskey不能为空!','','error'); 
            }
            if($_GPC['secretkey']==''){
                message('secretkey不能为空!','','error'); 
            }
            if($_GPC['bucket']==''){
                message('bucket不能为空!','','error'); 
            }
            if($_GPC['url']==''){
                message('url不能为空!','','error'); 
            }
            $data['uniacid']=trim($_W['uniacid']);
            if($_GPC['id']==''){                
                $res=pdo_insert('zh_gjhdbm_qiniu',$data);
                if($res){
                    message('添加成功',$this->createWebUrl('qiniu',array()),'success');
                }else{
                    message('添加失败','','error');
                }
            }else{
                $res = pdo_update('zh_gjhdbm_qiniu', $data, array('id' => $_GPC['id']));
                if($res){
                    message('编辑成功',$this->createWebUrl('qiniu',array()),'success');
                }else{
                    message('编辑失败','','error');
                }
            }
        }
    include $this->template('web/qiniu');